package ru.space.academy.model;

import com.fasterxml.jackson.annotation.JsonCreator;


public enum Profession {
    BACK_END("BACK_END"), FRONT_END("FRONT_END"), DEV_OPS("DEV_OPS"), NONE("NONE");

    private final String text;

    Profession(String text) {
        this.text = text;
    }

    @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
    public static Profession fromText(String text) {
        for (Profession r : Profession.values()) {
            if (r.getText().equalsIgnoreCase(text)) {
                return r;
            }
        }
        throw new IllegalArgumentException();
    }

    @Override
    public String toString() {
        return this.text;
    }

    public String getText() {
        return text;
    }
}
